/*
 * 角色
 *
 * @Author:    zhoujk
 * @Date:      2022-09-03 22:00:41
 */
import { postRequest } from '/src/lib/axios'

export const roleApi = {
  /**
   * 新增角色
   */
  insert: (param) => {
    return postRequest('/b-merchant/role/insert', param)
  },

  /**
   * 删除角色
   */
  delete: (param) => {
    return postRequest('/b-merchant/role/delete', param)
  },

  /**
   * 修改角色状态
   */
  updateStatus: (param) => {
    return postRequest('/b-merchant/role/update_status', param)
  },

  /**
   * 修改角色状态
   */
  updateDataPermission: (param) => {
    return postRequest('/b-merchant/role/update_data_permission', param)
  },

  /**
   * 修改角色
   */
  update: (param) => {
    return postRequest('/b-merchant/role/update', param)
  },

  /**
   * 根据id查询角色
   */
  findOne: (param) => {
    return postRequest('/b-merchant/role/find_id', param)
  },

  /**
   * 分页查询角色
   */
  page: (param) => {
    return postRequest('/b-merchant/role/page', param)
  },

  // ---------------------------- 角色菜单 ----------------------------

  /**
   * 保存角色菜单
   */
  saveRoleMenu: (param) => {
    return postRequest('/b-merchant/role/save/menu', param)
  },

  /**
   * 根据角色id查询角色菜单
   */
  findRoleMenu: (param) => {
    return postRequest('/b-merchant/role/find_id/menu', param)
  },

  /**
   * 根据角色id查询角色菜单
   */
  findRoleSelectedMenu: (param) => {
    return postRequest('/b-merchant/role/menu/find_id', param)
  },
}
